/*    */ package com.cr.api.controller;
/*    */ 
/*    */ import com.cr.business.domain.*;
/*    */
/*    */
/*    */
/*    */ import com.cr.business.service.*;
/*    */
/*    */
/*    */
/*    */ import com.cr.common.core.controller.BaseController;
/*    */ import com.cr.common.core.domain.AjaxResult;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
/*    */
/*    */
/*    */

/*    */
/*    */ @RestController
/*    */ @RequestMapping({"/api/index"})
         @Api(description = "首页显示")
         @CrossOrigin
/*    */ public class ApiIndexController extends BaseController {
/*    */   @Autowired
/*    */   private ICrBondClueService bondClueService;
/*    */   
/*    */   @Autowired
/*    */   private ICrDebtTransactionService debtTransactionService;
/*    */   
/*    */   @Autowired
/*    */   private ICrSourceEntrustmentService sourceEntrustmentService;
/*    */   
/*    */   @Autowired
/*    */   private ICrUserService userService;
/*     */  @Autowired
/*     */  private ICrEvidenceInfoService crEvidenceInfoService;
/*    */   
/*    */   @GetMapping({"/getIndex"})
/*    */   @ResponseBody
            @ApiOperation("首页显示 包括债权列表bondClueList 交易列表debtTransactionList 案源委托信息sourceEntrustmentList 律师列表userList")

/*    */   public AjaxResult getIndex(@RequestParam String city) {
/* 38 */     CrBondClue bondClue = new CrBondClue();
             bondClue.setApprovalStatus(1);
             bondClue.setCity(city);
/* 39 */     List<CrBondClue> bondClueList = this.bondClueService.selectCrBondClueList(bondClue);
/* 40 */     if (bondClueList.size() > 4)
/* 41 */       bondClueList = bondClueList.subList(0, 4);
             CrDebtTransaction crDebtTransaction = new CrDebtTransaction();
                crDebtTransaction.setApprovalStatus(1);
                crDebtTransaction.setCity(city);
/* 44 */     List<CrDebtTransaction> debtTransactionList = this.debtTransactionService.selectCrDebtTransactionList(crDebtTransaction);
/* 45 */     if (debtTransactionList.size() > 3)
/* 46 */       debtTransactionList = debtTransactionList.subList(0, 3);
                CrSourceEntrustment info = new CrSourceEntrustment();
                info.setApprovalStatus(1);
                info.setImplementationArea(city);
/* 49 */     List<CrSourceEntrustment> sourceEntrustmentList = this.sourceEntrustmentService.selectCrSourceEntrustmentList(info);
/* 50 */     if (sourceEntrustmentList.size() > 3)
/* 51 */       sourceEntrustmentList = sourceEntrustmentList.subList(0, 3); 
/* 55 */     CrUser user = new CrUser();
/* 56 */     user.setUserType(Integer.valueOf(1));
/* 57 */     List<CrUser> userList = this.userService.selectCrUserList(user);
/* 58 */     if (userList.size() > 8)
/* 59 */       userList = userList.subList(0, 8); 
/* 63 */     Map<String, Object> map = new HashMap<>();
/* 64 */     map.put("bondClueList", bondClueList);
/* 65 */     map.put("debtTransactionList", debtTransactionList);
/* 66 */     map.put("sourceEntrustmentList", sourceEntrustmentList);
/* 67 */     map.put("userList", userList);
/* 68 */     return AjaxResult.success(map);
/*    */   }
    /*    */   @GetMapping({"/getEvidence/{type}/{id}"})
    /*    */   @ResponseBody
               @ApiOperation("获取债权线索或交易证据信息")
                @ApiImplicitParams({
                        @ApiImplicitParam(name="id",value = "债权线索或交易Id",dataType = "数值型"),
                        @ApiImplicitParam(name="type",value = "0：线索证据 1：交易证据",dataType = "数值型")
                })
    /*  */ public AjaxResult getEvidence(@PathVariable @NotNull Long id, @PathVariable @NotNull Long type) {
                CrEvidenceInfo bondClue = new CrEvidenceInfo();
                bondClue.setClueId(id);
                //bondClue.setType(type.intValue());
                List<CrEvidenceInfo> bondClueList = this.crEvidenceInfoService.selectCrEvidenceInfoList(bondClue);
                Map<String, Object> map = new HashMap<>();
                map.put("evidenceList", bondClueList);
                return AjaxResult.success(map);
           }
/*    */ }


/* Location:              D:\tmp\creditorRights-admin\BOOT-INF\lib\creditorRights-api-4.7.0.jar!\com\cr\api\controller\ApiIndexController.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */